package org.example.rvo;

import lombok.Data;

import java.io.Serializable;

/**
 * 封装返回给前端的数据
 * @author jianma
 */
@Data
public class ResultVO implements Serializable {
    /** 每种成功或者失败的信息码 */
    private String resCode;
    /** 针对不同的信息码对应的提示内容 */
    private String resMsg;
    /** 成功或者失败后提交给前端的数据 */
    private Object resData;


    public ResultVO(String resCode, String resMsg, Object resData) {
        this.resCode = resCode;
        this.resMsg = resMsg;
        this.resData = resData;
    }
    public ResultVO(String resCode, String resMsg){
        this.resCode = resCode;
        this.resMsg = resMsg;
    }

    public static ResultVO success(String resCode, String resMsg, Object resData){
        return new ResultVO(resCode, resMsg, resData);
    }
    public static ResultVO success(String resCode, String resMsg){
        return new ResultVO(resCode, resMsg);
    }
    public static ResultVO failure(String resCode, String resMsg){
        return new ResultVO(resCode, resMsg);
    }
}
